import rmi.Discussion;
import rmi.Me;
import rmi.Message;

/**
 * @author arthur
 * 
 */
public class testLocalDiscution {

	/**
	 * @param args
	 * @throws Exception
	 */
	public static void main(final String[] args) throws Exception {
		Discussion a, b;

		final Me me = new Me("A", "A", 1099);
		final Me me2 = new Me("B", "B", 2000);

		a = new Discussion(me);
		me2.initDiscussion(a);
		b = me2.getCurrentDiscussions().get(0);

		// a.join(b, me2);
		// b.join(a, me);

		a.postMessage("B", "1", "kikoo1");
		b.postMessage("B", "1", "kikoo1");
		b.postMessage("A", "2", "kikoo2");
		a.postMessage("A", "2", "kikoo2");

		for (final Message m : a.getListMessages()) {
			System.out.println("Message id :" + m.getId() + "  Auteur :"
					+ m.getAuthor() + "   Message :" + m.getMessage());
		}
		for (final Message m : b.getListMessages()) {
			System.out.println("Message id :" + m.getId() + "  Auteur :"
					+ m.getAuthor() + "   Message :" + m.getMessage());
		}
	}

}
